import 'package:wanxiang_app/generated/json/base/json_convert_content.dart';
import 'package:wanxiang_app/bean/bind_account_entity.dart';

BindAccountEntity $BindAccountEntityFromJson(Map<String, dynamic> json) {
  final BindAccountEntity bindAccountEntity = BindAccountEntity();
  final int? code = jsonConvert.convert<int>(json['code']);
  if (code != null) {
    bindAccountEntity.code = code;
  }
  final String? msg = jsonConvert.convert<String>(json['msg']);
  if (msg != null) {
    bindAccountEntity.msg = msg;
  }
  final List<BindAccountData>? data = (json['data'] as List<dynamic>?)
      ?.map(
          (e) => jsonConvert.convert<BindAccountData>(e) as BindAccountData)
      .toList();
  if (data != null) {
    bindAccountEntity.data = data;
  }
  return bindAccountEntity;
}

Map<String, dynamic> $BindAccountEntityToJson(BindAccountEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['code'] = entity.code;
  data['msg'] = entity.msg;
  data['data'] = entity.data.map((v) => v.toJson()).toList();
  return data;
}

extension BindAccountEntityExtension on BindAccountEntity {
  BindAccountEntity copyWith({
    int? code,
    String? msg,
    List<BindAccountData>? data,
  }) {
    return BindAccountEntity()
      ..code = code ?? this.code
      ..msg = msg ?? this.msg
      ..data = data ?? this.data;
  }
}

BindAccountData $BindAccountDataFromJson(Map<String, dynamic> json) {
  final BindAccountData bindAccountData = BindAccountData();
  final int? id = jsonConvert.convert<int>(json['id']);
  if (id != null) {
    bindAccountData.id = id;
  }
  final String? telphone = jsonConvert.convert<String>(json['telphone']);
  if (telphone != null) {
    bindAccountData.telphone = telphone;
  }
  final String? nickname = jsonConvert.convert<String>(json['nickname']);
  if (nickname != null) {
    bindAccountData.nickname = nickname;
  }
  final String? bindingType = jsonConvert.convert<String>(json['binding_type']);
  if (bindingType != null) {
    bindAccountData.bindingType = bindingType;
  }
  final int? userId = jsonConvert.convert<int>(json['user_id']);
  if (userId != null) {
    bindAccountData.userId = userId;
  }
  final String? openId = jsonConvert.convert<String>(json['open_id']);
  if (openId != null) {
    bindAccountData.openId = openId;
  }
  final String? bankCard = jsonConvert.convert<String>(json['bank_card']);
  if (bankCard != null) {
    bindAccountData.bankCard = bankCard;
  }
  final String? zfbNum = jsonConvert.convert<String>(json['zfb_num']);
  if (zfbNum != null) {
    bindAccountData.zfbNum = zfbNum;
  }
  return bindAccountData;
}

Map<String, dynamic> $BindAccountDataToJson(BindAccountData entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['id'] = entity.id;
  data['telphone'] = entity.telphone;
  data['nickname'] = entity.nickname;
  data['binding_type'] = entity.bindingType;
  data['user_id'] = entity.userId;
  data['open_id'] = entity.openId;
  data['bank_card'] = entity.bankCard;
  data['zfb_num'] = entity.zfbNum;
  return data;
}

extension BindAccountDataExtension on BindAccountData {
  BindAccountData copyWith({
    int? id,
    String? telphone,
    String? nickname,
    String? bindingType,
    int? userId,
    String? openId,
    String? bankCard,
    String? zfbNum,
  }) {
    return BindAccountData()
      ..id = id ?? this.id
      ..telphone = telphone ?? this.telphone
      ..nickname = nickname ?? this.nickname
      ..bindingType = bindingType ?? this.bindingType
      ..userId = userId ?? this.userId
      ..openId = openId ?? this.openId
      ..bankCard = bankCard ?? this.bankCard
      ..zfbNum = zfbNum ?? this.zfbNum;
  }
}